package org.whuims.pois.action;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import org.whuims.pois.hibernate.BaseDao;
import org.whuims.pois.model.Term;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by john on 2015/5/6.
 */
public class TermAction extends DispatchAction {
    BaseDao baseDao = new BaseDao();

    public ActionForward show(ActionMapping mapping, ActionForm form,
                              HttpServletRequest request, HttpServletResponse response) {
        List<Term> list = baseDao.findTopN("from term order by createtime desc", 20);
        request.setAttribute("result", list);
        return mapping.findForward("show");
    }
}
